import { BasicColumn, FormSchema } from '@/components/Table';
import { h, ref } from 'vue';
import { Tag } from 'ant-design-vue';
import {VxeFormItemProps, VxeGridPropTypes} from "@/components/VxeTable";
import util from "@/utils/util";


//表格列名
export const columns: BasicColumn[] = [
  {
    title: '用户名',
    dataIndex: 'userName',
    width: 130,

  },
  {
    title: '试卷名称',
    dataIndex: 'paperName',
  },
  {
    title: '得分',
    dataIndex: 'score',
    width: 130,
  },
  {
    title: '创建时间',
    width: 160,
    dataIndex: 'createTime',
  },
  {
    title: '交卷时间',
    width: 160,
    dataIndex: 'endTime',
  },

];


/**
 */
export const vxeTableColumns: VxeGridPropTypes.Columns = [
  {
    title: '姓名',
    field: 'userName',
    showOverflow: 'title',
    formatter: ({ cellValue, row, column }) => `${row.postRoleName ? cellValue +"["+ row.postRoleName+"]" : cellValue}`,
    align: 'center',
  },
  {
    title: '评价项目',
    field: 'groupName',
    showOverflow: 'title',
    align: 'center',
  },
  {
    title: '评价标准',
    field: 'evaluationStandard',
    showOverflow: 'title',
    align: 'center',
    formatter: ({ cellValue, row, column }) => {
      if (!cellValue) {
        return "";
      }
      return cellValue;
    },
  },
  {
    title: '个人信息',
    field: 'userInfo',
    align: 'center',
    formatter: ({ cellValue, row, column }) => {
      if (!cellValue) {
        return "";
      }
      return cellValue;
    },
  },

  {
    title: '评价分数',
    field: 'evaluationScore',
    align: 'center',
  },
  {
    title: '评分系数',
    field: 'rate',
    align: 'center',
  },
  {
    title: '实际分数',
    field: 'resultScore',
    align: 'center',
  },

];


export const searchFormSchema: FormSchema[] = [
  {
    field: 'userName',
    label: '姓名',
    component: 'Input',
    colProps: { span: 8 },
  },
  {
    field: 'paperName',
    label: '试卷名称',
    component: 'Input',
    colProps: { span: 8 },
  },

];


export const vxeTableFormSchema: VxeFormItemProps[] = [
  {
    span: 5,
    field: 'keyword',
    title: '搜索',
    itemRender: {
      props: {
        placeholder: '部门/岗位',
      },
      name: 'AInput',
    },
  },

  {
    span: 5,
    itemRender: {
      name: 'VxeButtonGroup',
      options: [
        { type: 'reset', content: '重置' },
        { type: 'submit', content: '查询', status: 'primary' },
      ],
    },
  },
];


export const formSchema: FormSchema[] = [

  {
    field: 'deptName',
    label: '部门',
    component:"Input",
    required: true,
  },
  {
    field: 'roleName',
    label: '岗位',
    component:"Input",
    required: true,
  },
  {
    field: 'education',
    label: '学历要求',
    component:"Input",
    required: false,
  },
  {
    field: 'workNum',
    label: '工作经验',
    component:"Input",
    required: false,
  },
  {
    field: 'manageNum',
    label: '管理经验',
    component:"Input",
    required: false,
  },

  {
    field: 'industryNum',
    label: '行业经验',
    component:"Input",
    required: false,
  },
  {
    field: 'specialtyNum',
    label: '专业经验',
    component:"Input",
    required: false,
  },


];



export const teamUserColumns: VxeGridPropTypes.Columns = [
  {
    title: '姓名',
    field: 'userName',
    showOverflow: 'title',
    align: 'center',
    width: 120,
  },
  {
    title: '标题',
    field: 'title',
    showOverflow: 'title',
    align: 'center',
    // width: 150,
  },
  {
    title: '审批结果',
    field: 'result',
    showOverflow: 'title',
    align: 'center',
    slots:{
      default({row}) {
        let color="",text="";
        if(row.result=='agree'){
          text="同意";
          color="green";
        }else{
          text=row.result;
        }
        return h(Tag,{color},text)
      },
    },
    width: 80,
  },
  {
    title: '审批编号',
    field: 'approveNo',
    showOverflow: 'title',
    align: 'center',
    width: 150,
  },
  {
    title: '发起时间',
    field: 'addTime',
    showOverflow: 'title',
    align: 'center',
    width: 120,
  },
  {
    title: '原职位',
    field: 'original_post',
    showOverflow: 'title',
    align: 'center',
    width: 120,
  },
  {
    title: '转入职位',
    field: 'now_post',
    showOverflow: 'title',
    align: 'center',
    width: 120,
  },
  // {
  //   width: 120,
  //   title: '操作',
  //   align: 'center',
  //   field: '',
  //   slots: { default: 'action' },
  //   fixed: 'right',
  // },
  ]
